package com.ruoyi.project.distribute.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.project.distribute.domain.HosCompany;
import com.ruoyi.project.distribute.mapper.HosCompanyMapper;
import com.ruoyi.project.distribute.service.IHosCompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 生产厂家 业务层
 * @author anran
 */
@Service
public class HosCompanyServiceImpl implements IHosCompanyService
{
    @Autowired
    private HosCompanyMapper hosCompanyMapper;

    /**
     *  查询生产厂家信息
     *
     * @param hosCompany 生产厂家筛选条件
     * @return 生产厂家信息
     */
    @Override
    public List<HosCompany> selectByHosCompanyList(HosCompany hosCompany)
    {
        return hosCompanyMapper.selectByHosCompanyList(hosCompany);
    }

    /**
     *  新增生产厂家
     *
     * @param hosCompany 生产厂家信息
     * @return 新增结果
     */
    @Override
    public int insertHosCompany(HosCompany hosCompany)
    {
        hosCompany.setCreateTime(DateUtils.getNowDate());
        return hosCompanyMapper.insertHosCompany(hosCompany);
    }

    /**
     * 删除生产厂家信息
     *
     * @param companyId 生产厂家信息ID(数组)
     * @return 删除结果
     */
    @Override public int deleteHosCompanyByIds(Long[] companyId)
    {
        return hosCompanyMapper.deleteHosCompanyByIds(companyId);
    }

    /**
     * 根据ID查询生产厂家信息
     *
     * @param CompanyId 生产厂家信息
     * @return 生产厂家信息
     */
    @Override public HosCompany selectHosCompanyById(Long CompanyId)
    {
        return hosCompanyMapper.selectHosCompanyById(CompanyId);
    }

    /**
     * 修改生产厂家信息
     *
     * @param hosCompany
     * @return
     */
    @Override public int updateHosCompany(HosCompany hosCompany)
    {
        hosCompany.setCreateTime(DateUtils.getNowDate());
        return hosCompanyMapper.updateHosCompany(hosCompany);
    }
}
